Calcular Tabela de Amortização (Com IOF)
Segurança
Para acessar a API, é necessário obter um token de acesso através do fluxo de autenticação OAuth2. Veja mais detalhes em Como obter acesso?
info
Ao gerar o token JWT, não esqueça de utilizar o escopo correto. Caso contrário, a requisição será rejeitada com o código de erro 401 Unauthorized.
Descrição dos campos
Campo | Tipo | Descrição |
---|---|---|
interest_rate | number | Valor da taxa de juros. No formato "0.0000" |
present_value | number | Valor atual |
number_of_payments | number | Número de pagamentos |
payment_dates[] | string | Array com lista de datas. No formato "YYYY-MM-DD" |
Requisição
POST https://api-sandbox.catalisa.com.br/calc-engine/api/loan-amortization-schedule-calculator/calculationsParâmetros
Sem parâmetros
Cabeçalhos
Nome | Valor |
---|---|
Authorization | Bearer <token> |
Content-Type | application/json |
Exemplo de Requisição
Corpo da Requisição
{
"data": {
"type": "calculations",
"attributes": {
"interest_rate": 0.0465,
"present_value": 10130.31,
"number_of_payments": 6,
"payment_dates": [
"2023-10-18",
"2023-11-18",
"2023-12-18",
"2024-01-18",
"2024-02-18",
"2024-03-18"
]
}
}
}
Respostas
Código | Descrição |
---|---|
201 | Criado com sucesso. Retorna os dados calculados. |
401 | Não autorizado |
Exemplo de uso
- Javascript
- CURL
const headers = new Headers();
headers.append("Authorization", "Bearer <token>");
headers.append("Content-Type", "application/json");
const body = JSON.stringify({
data: {
type: "calculations",
attributes: {
interest_rate: 0.0465,
present_value: 10130.31,
number_of_payments: 6,
payment_dates: [
"2023-10-18",
"2023-11-18",
"2023-12-18",
"2024-01-18",
"2024-02-18",
"2024-03-18"
]
}
}
});
const requestOptions = {
method: "POST",
headers: headers,
body: body,
};
const response = await fetch(
"https://api-sandbox.catalisa.com.br/calc-engine/api/loan-amortization-schedule-calculator/calculations",
requestOptions
);
const data = await response.json();
console.log(data);
curl --location 'https://api-sandbox.catalisa.com.br/calc-engine/api/loan-amortization-schedule-calculator/calculations' \
--header 'Authorization: Bearer <token>' \
--data '{
"data": {
"type": "calculations",
"attributes": {
"interest_rate": 0.0465,
"present_value": 10130.31,
"number_of_payments": 6,
"payment_dates": [
"2023-10-18",
"2023-11-18",
"2023-12-18",
"2024-01-18",
"2024-02-18",
"2024-03-18"
]
}
}
}'
Exemplo de Sucesso
{
"data": {
"id": "6f7ac4cc-f1e0-42b1-99ea-9cef5b05b989",
"type": "calculations",
"attributes": {
"amortization_schedule": [
{
"payment_number": 1,
"payment_date": "2023-10-18",
"beginning_balance": 10130.31,
"payment": 1973.56418,
"principal_payment": 1502.50476,
"interest_payment": 471.05942,
"remaining_balance": 8627.8052
},
{
"payment_number": 2,
"payment_date": "2023-11-18",
"beginning_balance": 8627.80524,
"payment": 1973.56418,
"principal_payment": 1572.37124,
"interest_payment": 401.19294,
"remaining_balance": 7055.434
},
{
"payment_number": 3,
"payment_date": "2023-12-18",
"beginning_balance": 7055.434,
"payment": 1973.56418,
"principal_payment": 1645.4865,
"interest_payment": 328.07768,
"remaining_balance": 5409.9475
},
{
"payment_number": 4,
"payment_date": "2024-01-18",
"beginning_balance": 5409.9475,
"payment": 1973.56418,
"principal_payment": 1722.00162,
"interest_payment": 251.56256,
"remaining_balance": 3687.9459
},
{
"payment_number": 5,
"payment_date": "2024-02-18",
"beginning_balance": 3687.94588,
"payment": 1973.56418,
"principal_payment": 1802.0747,
"interest_payment": 171.48948,
"remaining_balance": 1885.8712
},
{
"payment_number": 6,
"payment_date": "2024-03-18",
"beginning_balance": 1885.87118,
"payment": 1973.56418,
"principal_payment": 1885.87117,
"interest_payment": 87.69301,
"remaining_balance": 0
}
]
}
}
}